import { instance as request } from "@/utils/request";
type RETURNDATA = {
  code: number;
  msg: string;
  data?: any;
};
// const Get = (url: string, params?: any) => {
//   return request<any, RETURNDATA>({
//     method: "GET",
//     url,
//     params: params,
//   })
// }
// const Post = (url: string, data?: any) => {
//   return request<any, RETURNDATA>({
//     method: "POST",
//     url,
//     data: data,
//   })
// }
// const Put = (url: string, params?: any, data?: any) => {
//   return request<any, RETURNDATA>({
//     method: "PUT",
//     url,
//     data: data,
//     params: params,
//   })
// }
// const Delete = (url: string, params?: any) => {
//   return request<any, RETURNDATA>({
//     method: "DELETE",
//     url,
//     params: params,
//   })
// }
const getRoleList = (url: string, params?: any) => {
  return request<any, RETURNDATA>({
    method: "GET",
    url,
    params: params,
  });
};
const addRole = (url: string, data?: any) => {
  return request<any, RETURNDATA>({
    method: "POST",
    url,
    data: data,
  });
};
const delRole = (url: string, params?: any) => {
  return request<any, RETURNDATA>({
    method: "DELETE",
    url,
    params: params,
  });
};

const distributeRole = (url: string, data?: any) => {
  return request<any, RETURNDATA>({
    method: "PUT",
    url,
    data: data,
  });
};

export { getRoleList, addRole, delRole, distributeRole };
